<template>
  <view class="comp-a" style="background-color: #f59e0b; padding: 20rpx; border-radius: 8rpx;">
    <text style="font-size: 32rpx; font-weight: bold; color: #000; margin-bottom: 20rpx; display: block;">子组件A</text>
    <view class="a-box" style="font-size: 28rpx; color: #000; margin-bottom: 20rpx;">
      <text>父组件传进来的值:</text>
      <text style="font-weight: bold; color: red; margin-left: 10rpx;">{{ intent }}</text>
    </view>
    <button 
      type="primary" 
      @click="sendDataToCompB" 
      style="width: 100%;"
    >
      传值给CompB组件
    </button>
  </view>
</template>

<script>
export default {
  props: {
    intent: {
      type: String,
      default: "",
      required: true
    }
  },
  methods: {
    sendDataToCompB() {
      uni.$emit("getIntent", this.intent);
    }
  }
};
</script>

<style scoped>
/* 样式已内联在template中 */
</style>